'''
msg: 
name: 
param: 
return: 
'''
from loguru import logger
import sys

def configure_logger():
    global logger
    logger.remove()
    
    # 控制台日志格式
    console_format = (
        "<green>{time:YYYY-MM-DD HH:mm:ss}</green> | "
        "<level>{level: <8}</level> | "
        "<cyan>{module}:{line}</cyan> - <white>{message}</white>"
    )
    
    # 文件日志格式（包含更多细节）
    file_format = (
        "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | "
        "{module}:{function}:{line} | {message}"
    )
    
    logger.add(
        sys.stderr,
        format=console_format,
        level="DEBUG",  # 默认调整为DEBUG级别
        colorize=True
    )
    logger.add(
        "logs/processing.log",
        format=file_format,
        rotation="500 MB",
        retention="30 days",
        encoding="utf-8",
        level="INFO",  # 文件日志保持INFO级别
        backtrace=True,  # 开启堆栈跟踪
        diagnose=True    # 显示变量值
    )
    return logger 